package cn.hr.services.impl;

import static org.junit.Assert.*;

import java.sql.Timestamp;

import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import cn.hr.entity.Message;
import cn.hr.services.IHandleMessage;
import cn.hr.services.impl.HandleMessageImpl;

public class HandleMessageImplTest {
	private ApplicationContext cx;
	private Message message;

	@Before
	public void setUp() throws Exception {
		  cx = new ClassPathXmlApplicationContext("applicationContext.xml");
		  //实例化Message对象
		  message = new Message();
		  message.setEmail("u_xtian@qq.com");
//		  message.setId(new Long("2"));
		  message.setPublishTime(new Timestamp(new Long("123456789")));
		  message.setQq("654564454");
		  message.setReplyPeople("abc");
		  message.setContent("contend");
		  System.out.println("初始化成功");
	}

	@Test
	public void testInit() {
	}
	@Test
	public void testGetCommonDao() {
		fail("Not yet implemented");
	}

	@Test
	public void testSetCommonDao() {
		fail("Not yet implemented");
	}

	@Test
	public void testAddMessage() {
		  IHandleMessage ih = (HandleMessageImpl)cx.getBean("handleMessage");
		  ih.addMessage(message);
	}

	@Test
	public void testDeleteMessage() {
		  IHandleMessage hm = (HandleMessageImpl)cx.getBean("handleMessage");
		  message.setId(new Long("2"));
		  assertFalse(hm.deleteMessage(message));
	}

	@Test
	public void testFindMessageById() {
		fail("Not yet implemented");
	}

	@Test
	public void testListAllMessage() {
		fail("Not yet implemented");
	}

	@Test
	public void testUpdateMessage() {
		fail("Not yet implemented");
	}

	@Test
	public void testMain() {
		fail("Not yet implemented");
	}

}
